#pragma once

template<typename Key, typename Val, typename Hash>
template<typename... Args>
std::pair<typename hHashMap<Key, Val, Hash>::Iter, bool> hHashMap<Key, Val, Hash>::emplace(Key k, Args... args)
{
	Iter it;
	it._pMap = this;
	size_t hash = Hash{}(k);
	return _node.emplaceCallBack(it, hash, k, args...);
}

template<typename Key, typename Val, typename Hash>
typename hHashMap<Key, Val, Hash>::Iter hHashMap<Key, Val, Hash>::find(Key k)
{
	Iter it;
	it._pMap = this;
	size_t hash = Hash{}(k);
	return _node.findCallBack(it, hash, k);
}

template <typename Key, typename Val, typename Hash>
typename hHashMap<Key, Val, Hash>::Iter hHashMap<Key, Val, Hash>::begin()
{
	Iter it;
	it._pMap = this;

	do
	{
		if (_node._pValPr)
		{
			it._pNode = &_node;
			break;
		}

		it._pNode = _node.getNext();
	} while (0);

	return it;
}

template <typename Key, typename Val, typename Hash>
typename hHashMap<Key, Val, Hash>::Iter hHashMap<Key, Val, Hash>::end()
{
	Iter it;
	it._pMap = this;
	return it;
}

template<typename Key, typename Val, typename Hash>
std::ostream& hHashMap<Key, Val, Hash>::fillDebug(std::ostream& os, uint8_t idx) const
{
	return _node.fillDebug(os, idx);
}